#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>

using namespace std;

class Solution
{
public:
    double myPow(double x, long long n)
    {
        if (n > 0)
        {
            if (n == 0) return 1;
            double tmp = myPow(x, n / 2);
            return n % 2 == 0 ? tmp * tmp : tmp * tmp * x;
        }
        else
        {
            n = abs(n);
            if (n == 0) return 1;
            double tmp = myPow(x, n / 2);
            return n % 2 == 0 ? 1 / (tmp * tmp) : 1 / (tmp * tmp * x);
        }
    }
};